<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('路段列表')" />
</head>
<body class="gray-bg">
     <input id="roadcode"  hidden="hidden" th:value="${roadcode}"/>
     <div class="container-div">
		<div class="row">
			<!--<div class="col-sm-12 search-collapse">-->
				<!--<form id="formId">-->
					<!--<div class="select-list">-->
						<!--<ul>-->
							<!--<li>-->
								<!--道路编码：<input type="text" name="roadcode"/>-->
							<!--</li>-->

							<!--<li>-->
								<!--道路名称：<input type="text" name="roadname"/>-->
							<!--</li>-->

							<!--<li>-->
								<!--所属乡镇：<input type="text" name="deptId"/>-->
							<!--</li>-->

							<!--<li>-->
								<!--<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
								<!--<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
							<!--</li>-->
						<!--</ul>-->
					<!--</div>-->
				<!--</form>-->
			<!--</div>-->
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editTab()" shiro:hasPermission="roadnet:baseRoadwaysection:edit">
					<i class="fa fa-edit"></i> 查看路段
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="roadnet:baseRoadwaysection:export">
						<i class="fa fa-download"></i> 导出
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('roadnet:baseRoadwaysection:detail')}]];
        var prefix = ctx + "roadnet/baseRoadwaysection";
		var roadcode=$("#roadcode").val();
        $(function() {
            var options = {
                url: prefix + "/Roadwaysectionlist/"+roadcode,
				detailUrl: prefix + "/view/{id}",
				exportUrl: prefix + "/export",
                modalName: "路段",
		        showExport: true,
				showSearch:false,
				striped: true,//斑马线
                columns: [{
		            checkbox: true
		        },
				{
					field : 'roadcode', 
					title : '道路编码',
					sortable: false
				},
					{
						field : 'roadsectionid',
						title : '路段序号',
						sortable: true
					},
				{
					field : 'roadname', 
					title : '道路名称',
					sortable: false
				},
				{
					field : 'startnum',
					title : '开始桩号',
					sortable: true,
					formatter: function (value, row, index) {
						return convertToKPlus(value);
					}
				},
				{
					field : 'endnum',
					title : '结束桩号',
					sortable: true,
					formatter: function (value, row, index) {
						return convertToKPlus(value);
					}
				},
				{
					field : 'deptId',
					title : '所属乡镇',
					sortable: false
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + detailFlag  + '" href="#" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>路段详情</a> ');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);

            var  convertToKPlus=function(num) {
				return 'K' + num.toFixed(3).replace('.', '+');
			}
        });
    </script>
</body>
</html>